package com.foreknow.demo5;

import org.omg.CORBA.StringHolder;

/**
 * 类：具有相同属性和行为的一个模板
 */
public class Student {
    //属性(变量)
    String sid;
    String name;
    int age;
    String school;
    //行为(方法)
    public void study() {
        System.out.println("study......");
    }

    public void eat() {
        System.out.println("eat......");
    }

    public void sleep() {
        System.out.println("sleep......");
    }

    public void game() {
        System.out.println("game......");
    }

    public static void main(String[] args) {
        //如果想调用类中的方法 首先就要创建student类的对象
        Student stu1 = new Student();
        //给stu1这个对象的属性赋值
        stu1.sid = "s10001";
        stu1.name = "tom";
        stu1.age = 12;
        stu1.school = "foreknow";
        //调用对象中的方法
        stu1.study();
        stu1.eat();
        stu1.sleep();
        stu1.game();
        System.out.println(stu1.sid+"----"+stu1.name+"----"+stu1.age+"----"+stu1.school);

        Student stu2 = new Student();
        stu2.sid = "s10002";
        stu2.name = "lily";
        stu2.age = 11;
        stu2.school = "neu";
        stu2.study();
        stu2.eat();
        stu2.sleep();
        stu2.game();
        System.out.println(stu2.sid+"----"+stu2.name+"----"+stu2.age+"----"+stu2.school);

    }

}













